package com.service.xsxt;

import com.dao.xsxt.PrizeSetMapper;
import com.entity.common.ApiResult;
import com.entity.xsxt.PrizeSet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by System on 2019/03/15 09:17:28.
 */
@Service
public class PrizeSetService {

    @Autowired
    private PrizeSetMapper prizeSetMapper;

    public List<PrizeSet> getPageList(PrizeSet prizeSet){
        return prizeSetMapper.getPageList(prizeSet);
    }

    public ApiResult addPrizeSet(PrizeSet prizeSet) {
        int num = prizeSetMapper.insertSelective(prizeSet);
        return  new ApiResult(num);
    }

    public ApiResult getPrizeSetById(Integer id) {
        PrizeSet prizeSet = prizeSetMapper.selectByPrimaryKey(id);
        return new ApiResult(true,"获取数据成功！",prizeSet);
    }

    public ApiResult editPrizeSet(PrizeSet prizeSet) {
        int num = prizeSetMapper.updateByPrimaryKeySelective(prizeSet);
        return  new ApiResult(num);
    }

    public ApiResult deletePrizeSet(int id) {
        int num = prizeSetMapper.deleteByPrimaryKey(id);
        return  new ApiResult(num);
    }
}
